package HomeWork;

public class CamelToSnake {
    /**
     *  驼峰转蛇形
     * @param string
     * @return
     */
    public static String camelToSnake(String string)
    {
        String separator = "_";
        string = string.replaceAll("([a-z])([A-Z])", "$1"+separator+"$2").toLowerCase();
        return string;
    }
    public static void main(String[] args) {
        System.out.println(CamelToSnake.camelToSnake("MyName"));
    }
}
